home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_plotutils.idb / usr / freeware / share / ode / ddho.ode.z / ddho.ode
Encoding:
Text File  |  1998-10-28  |  644 b   |  33 lines

  1. # You may run this example by doing:
  2. #
  3. #    ode < ddho.ode | graph -T X -C
  4. # or alternatively, to get a real-time plot,
  5. #
  6. #    ode < ddho.ode | graph -T X -C -x 0 25 -y -0.5 1 0.5
  7. # This example simulates a dam-driven harmonic oscillator (DDHO) with
  8. # damping, the equation for which is
  9. # y'' = -k/m * y - R/m * y' + cos(w*t)
  10. # If R^2 > 4km, motion is overdamped
  11. # If R^2 = 4km, motion is critically damped
  12. # If R^2 < 4km, motion is damped
  13. # With the choice of parameters below, motion is damped but not
  14. # overdamped.
  15.  
  16. y'    = vy
  17. vy'    = -k/m * y - R/m * vy + cos(w*t)
  18.  
  19. y    = 1
  20. vy    = 0
  21. k    = 1
  22. m    = 1
  23. R    = 0.5
  24. w    = 2*PI
  25.  
  26. print t, y
  27. step 0,25
  28.